ES索引的一些长度限制 |
您所在的位置:网站首页 › es keyword长度是多少 › ES索引的一些长度限制 |
ES索引的一些长度限制 ![]() 2020-02-23 关注 关注一个ES索引最大可以支持多少个shard?理论上无限扩展,我推测最大应该是java array的最大长度:Integer.MAX_VALUE。通常业务为了保证查询效率,往往会限制data node上shards的总个数(cluster.routing.allocation.total_shards_per_node)或者某个索引的shards个数(index.routing.allocation.total_shards_per_node)。 一个ES shard(lucene index)最多可以索引2,147,483,519个document。https://issues.apache.org/jira/browse/LUCENE-5843 一个ES mapping默认最多可以有1000个字段(index.mapping.total_fields.limit),因为ES DSL默认最多支持1000个search条件表达式(rewrite之后)。nest对象默认最多50个字段(index.mapping.nested_fields.limit),另外最多支持10000个nest对象(index.mapping.nested_objects.limit)。 一个ES keyword字段支持的最大keyword长度是32766个byte(这个是hard code的为ByteBlockPool的BYTE_BLOCK_SIZE-2),如果keyword字段存的是ES的Array, 则变为Array中的每term最大32766个byte,Array的最大size不受约束,但Array最大存储量是所有keyword总和为2147483647,可参考Lucene8.0.0的BytesRefHash的类注释。 这就引出来一个有趣的问题,ES type=keyword的字段存Array和单个keyword的区别在哪里? ES本身并不做底层的索引和存储,lucene承担了这部分工作,通过lucene构造一个带有Array字段的document如下: public static void indexDocument(IndexWriter writer) throws IOException { List cityNameList = new ArrayList(); cityNameList.add("BeiJing"); cityNameList.add("ShangHai"); cityNameList.add("HangZhou"); Document doc = new Document(); for(int i = 0; i |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |